/*
 * PACKAGE NAME: com.jodinfo.outmirror.api.reportaccessstoragebarcode.controller
 * FILE    NAME: ReportAccessStorageBarcodeDaoImpl.java
 * COPYRIGHT: Copyright(c) © 2016 heroj Company Ltd. All Rights Reserved
 */ 
package com.jodinfo.outmirror.api.reportaccessstoragebarcode.controller;

import java.math.BigInteger;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.alibaba.fastjson.JSON;
import com.hero.common.web.context.UserContext;
import com.hero.core.constant.SysConstant;
import com.hero.core.entity.ResponseEntity;
import com.jodinfo.outmirror.api.reportaccessstoragebarcode.entity.ReportAccessStorageBarcodeEntity;
import com.jodinfo.outmirror.api.reportaccessstoragebarcode.service.ReportAccessStorageBarcodeBizService;



@Controller
@RequestMapping(value = "/ReportAccessStorageBarcodeAdmin")
public class ReportAccessStorageBarcodeController  {
	
@Resource(name="reportAccessStorageBarcodeBizService")
private ReportAccessStorageBarcodeBizService ReportAccessStorageBarcodeBizService;
/**
*  list数据源
* 
* */
@RequestMapping(value = "/List")
@ResponseBody
public String ReportAccessStorageBarcodeList(ReportAccessStorageBarcodeEntity ReportAccessStorageBarcodeEntity) {
	if(ReportAccessStorageBarcodeEntity==null){
		ReportAccessStorageBarcodeEntity = new ReportAccessStorageBarcodeEntity();
		ReportAccessStorageBarcodeEntity.setPageIndex(SysConstant.DEFAULT_PAGEINDEX);
		ReportAccessStorageBarcodeEntity.setPageSize(SysConstant.DEFAULT_PAGESIZE);
	}
	ReportAccessStorageBarcodeEntity.setCurrentUser(UserContext.getUser());
	String str = ReportAccessStorageBarcodeBizService.queryListForPageReportAccessStorageBarcode(ReportAccessStorageBarcodeEntity);
	return str;
}
/**
* ReportAccessStorageBarcodeEntity List页面
* 
* */
@RequestMapping(value = "/ListPage")
public ModelAndView ReportAccessStorageBarcodeListPage(ReportAccessStorageBarcodeEntity ReportAccessStorageBarcodeEntity,HttpServletRequest request) {
	
	return new ModelAndView(returnPath("ReportAccessStorageBarcodeList"));
}
/**
* ReportAccessStorageBarcodeEntity详细页 
* 
* */
@RequestMapping(value = "/EditPage")
public ModelAndView ReportAccessStorageBarcodeEditPage(ReportAccessStorageBarcodeEntity ReportAccessStorageBarcodeEntity) {
	
	return new ModelAndView(returnPath("ReportAccessStorageBarcodeAdd"));
}
/**
 * 查询ReportAccessStorageBarcodeEntity
 * 
 * */
@RequestMapping(value = "/queryByID")
public @ResponseBody String findReportAccessStorageBarcodeData(HttpServletRequest request) {
	String id = request.getParameter("id");
	ReportAccessStorageBarcodeEntity ReportAccessStorageBarcodeEntity =  ReportAccessStorageBarcodeBizService.queryById(new BigInteger(id));
	return JSON.toJSONString(ReportAccessStorageBarcodeEntity); 
}

/**
 * 保存或更新ReportAccessStorageBarcode 
 * 
 * */
@RequestMapping(value = "/saveReportAccessStorageBarcode")
public @ResponseBody String saveReportAccessStorageBarcodeData(@RequestBody ReportAccessStorageBarcodeEntity ReportAccessStorageBarcodeEntity) {
	ResponseEntity rs = null;
	if(ReportAccessStorageBarcodeEntity!=null){
		ReportAccessStorageBarcodeEntity.setCurrentUser(UserContext.getUser());
		if(ReportAccessStorageBarcodeEntity.getId()!=null){
			rs = ReportAccessStorageBarcodeBizService.updateReportAccessStorageBarcode(ReportAccessStorageBarcodeEntity);
		}else{
			rs = ReportAccessStorageBarcodeBizService.addReportAccessStorageBarcode(ReportAccessStorageBarcodeEntity);
		}
	}
	return JSON.toJSONString(rs);
}
/**
 * 导出ReportAccessStorageBarcodeEntity
 * @author weiwei
 * @date 2015-7-09  下午2:13:28
 * @return
 */
@RequestMapping(value = "/exportReportAccessStorageBarcodeExcel")
public void exportReportAccessStorageBarcodeExcel(ReportAccessStorageBarcodeEntity ReportAccessStorageBarcodeEntity,HttpServletResponse response) {
	if(ReportAccessStorageBarcodeEntity==null) ReportAccessStorageBarcodeEntity = new ReportAccessStorageBarcodeEntity();
	ReportAccessStorageBarcodeEntity.setCurrentUser(UserContext.getUser());
	ReportAccessStorageBarcodeBizService.exportReportAccessStorageBarcode(ReportAccessStorageBarcodeEntity, response);
}


 /**
 * 
 * 批量删除
 * @author weiwei
 * @date 2017年3月13日 下午2:48:57
 * @param ReportAccessStorageBarcodeEntity
 * @return
 */
@RequestMapping(value = "/batchDelReportAccessStorageBarcode")
public @ResponseBody String batchDelReportAccessStorageBarcode(ReportAccessStorageBarcodeEntity ReportAccessStorageBarcodeEntity) {
	ResponseEntity rs = null;
	rs = ReportAccessStorageBarcodeBizService.batchDelReportAccessStorageBarcode(ReportAccessStorageBarcodeEntity);
	return  JSON.toJSONString(rs);
}
/**
 * 定义
 * 
 */
private final String MODULE_PATH = "/reportaccessstoragebarcode/";

//返回路径
private String returnPath(String jspName) {
	return MODULE_PATH + jspName;
}
}
